import Vue from 'vue'
import Vuex from 'vuex'
Vue.use(Vuex)

const store = new Vuex.Store({
	state: {
		isResetSum: true,
		personType: '',
		isUnitTicket: false,
		isMyTicket: false
	},
	mutations: {
		resetSum(state, data) {
			state.isResetSum = data
		},
		setPersonType(state, data){
			state.personType = data
			uni.setStorageSync('personType', data)
		},
		setTicketType(state, data){
			state.isUnitTicket = data
		},
		setMyTicket(state, data) {
			// state.isUnitTicket = data
			state.isMyTicket = data 
		}
	},
	actions: {

	},
	getters: {
		personType(state) {
			if(!state.personType) {
				state.personType = uni.getStorageSync('personType')
			}
			return state.personType
		}
	}
})
export default store
